﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace eVoteClient
{
    public partial class ActivateAccount : Form
    {
        public ActivateAccount()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            global.socket = new util.Socket_io(global.destIP, global.destPort);
            var socket = global.socket;
            socket.writer.WriteLine("ACT_REQ#"+emailTxt.Text+"#"+actCodeTxt.Text);
            socket.writer.Flush();
            string reply = socket.reader.ReadLine();
            if (reply.Contains("0"))
                MessageBox.Show("Sorry activation code incorrect for this email");
            else if (reply.Contains("1"))
            {
                MessageBox.Show("Your account has been activate. Proceed to login");
                new Login().Show();
                this.Hide();
            }
        }

        private void ActivateAccount_Load(object sender, EventArgs e)
        {
            this.Location = new Point(350, 200);
            this.Size = new Size(572, 324);
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            new Login().Show();
        }
    }
}
